<script setup lang="ts">
import { PropType, reactive } from 'vue'
import { SmallInstanceInfo } from '@/api/classify/type'
import { Descriptions, DescriptionsSchema } from '@/components/Descriptions'
// import { departmentMap } from '../../../../public/department';
import { inject } from 'vue'

const  departmentMap  = inject<any>('departmentMap')

defineProps({
  currentRow: {
    type: Object as PropType<SmallInstanceInfo>,
    default: () => undefined
  }
})

const schema = reactive<DescriptionsSchema[]>([
  {
    field: 'classificationName',
    label: '分类名称',
  },
  {
    field: 'classificationCode',
    label: '分类代码',
  },
  {
    field: 'parentName',
    label: '所属中类名称',
  },
  {
    field: 'parentCode',
    label: '所属中类代码',
  },
  {
    field: 'department',
    label: '责任单位',
    span: 24,
    slots: {
      default: (row) => {
        return row.department ? departmentMap[row.department] : '暂未绑定责任单位'
      }
    }
  }
])
</script>

<template>
  <Descriptions :schema="schema" :data="currentRow || {}" />
</template>
